﻿using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using UnityEngine;
using Util.Dispatcher;

public class Main : MonoBehaviour {

    public class CPPDLL {
        
    }

    [DllImport("DLL1")]
    private static extern int add(int x, int y);

    public void Awake()
    {
        //NotificationCenter.Get().AddEventListener("ChangeColor", ChangeColor);
        Dispatcher.Instance.AddListener("Start", Change);
    }

    // Use this for initialization
    void Start () {
        int f= add(1, 2);
        Debug.Log(f);

        //NotificationCenter.Get().DispatchEvent("ChangeColor", gameObject,"发送者："+gameObject.name+"-->发送通知");
        Dispatcher.Instance.Brocast("Start",new string[] {"发送通知"});
    }
	
	// Update is called once per frame
	void Update () {
		
	}

    void Change(Message evt ) {
        Debug.Log(evt.ToString());
    }
}
